SingleSelector

class SingleSelector<T>(selectedItem: T?, safeChanges: Boolean) : Selector<T>

Realization of Selector with one or without selected element. This realization will always have empty selectedItems when nothing selected and one element in selectedItems when something selected. Contains selectedItem value for simple access to currently selected item.

On calling of toggleSelection previous selection will be erased and itemUnselected will emit this element.

Parameters

safeChanges

Set to false to disable using of mutex for synchronizing changes on toggleSelection

Constructors

SingleSelector
Link copied to clipboard
common
fun <T> SingleSelector(selectedItem: T? = null, safeChanges: Boolean = true)

Functions

clearSelection
Link copied to clipboard
common
open suspend override fun clearSelection()
forceDeselect
Link copied to clipboard
common
open suspend override fun forceDeselect(element: T)
forceSelect
Link copied to clipboard
common
open suspend override fun forceSelect(element: T)
toggleSelection
Link copied to clipboard
common
open suspend override fun toggleSelection(element: T)

Properties

itemSelected
Link copied to clipboard
common
open override val itemSelected: SharedFlow<T>
itemUnselected
Link copied to clipboard
common
open override val itemUnselected: SharedFlow<T>
selectedItem
Link copied to clipboard
common
var selectedItem: T?
selectedItems
Link copied to clipboard
common
open override val selectedItems: List<T>